//
//  SelectSpecificController.m
//  YSSmartHome
//
//  Created by yanghao on 16/9/19.
//  Copyright © 2016年 yahaong. All rights reserved.
//

#import "SelectSpecificController.h"
#import "YHMarcros.h"

@interface SelectSpecificController ()
@property (nonatomic, strong)UIView *datePickerBgView;
@end

@implementation SelectSpecificController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"选择特定时间";
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"保存" style:UIBarButtonItemStyleDone target:self action:@selector(save)];
    UIDatePicker *datePicker = [[UIDatePicker  alloc]init];
    datePicker.backgroundColor = [UIColor whiteColor];
    datePicker.datePickerMode =  UIDatePickerModeDate;
    datePicker.locale = [[NSLocale alloc]initWithLocaleIdentifier:@"zh_CN"];
    [datePicker addTarget:self action:@selector(dateChange:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:datePicker];
    [datePicker mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(10);
        make.trailing.leading.equalTo(self.view);
        make.height.equalTo(230);
    }];
   
}

- (void)save {
    
}
- (void)dateChange:(UIDatePicker *)datePicker
{
    NSDateFormatter *fmt = [[NSDateFormatter alloc]init];
    fmt.dateFormat = @"yyyy-MM-dd HH:mm:ss";
    NSString *dateStr = [fmt stringFromDate:datePicker.date];
   debugLogInfo(@"dateStr = %@",dateStr);
}

#pragma mark - lazy loading


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
